package com.tf_cut.admin.platform.controller;

import com.alibaba.fastjson.JSON;
import com.tf_cut.admin.backend.api.BackEndApi;
import com.tf_cut.admin.platform.vo.ListGrantDetailVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;


@RestController
@RequestMapping("/platform/grantdetail")
@Slf4j
public class GrantDetailController {
    @Autowired
    private BackEndApi platformGrantApi;

    @GetMapping("list")
    public ModelAndView sellerList() {
        return new ModelAndView("platform/grantdetail/list", "platformGrantDetail", null);
    }

    @Deprecated
    @PostMapping("update")
    public String updateGrant(ListGrantDetailVo listGrantDetailVo) {
        log.info("listGrantDetailVo={}", listGrantDetailVo);
        String rtnJson = "";
        try {
            log.info("listGrantDetailVo toJson={}", JSON.toJSONString(listGrantDetailVo));
//            rtnJson = platformGrantApi.updateGrantDetail(JSON.toJSONString(listGrantDetailVo));
        } catch (Exception e) {
            log.error("updateGrant error:{}", e.getMessage(), e);
        }
        return rtnJson;
    }

}
